if not is_plat("android") then
    add_requires("local_jni" , {configs = {java_home=get_config("JAVA_HOME")}})
end

target("daemon_java")
    set_kind('shared')
    add_rules("swig.c", {moduletype = "java"})
    add_files("daemon.i", {scriptdir = "java"})
    add_deps("daemon")
    add_includedirs("./")

    if not is_plat("android") then
        add_packages("local_jni")
    end

    on_install(function (target)
        javapath = path.join(target:installdir() , "java")
        os.mkdir(javapath)

        os.cp(target:targetfile() , javapath)
        -- print(target:data("swig.scriptfiles"))
        for _,genfile in pairs(target:data("swig.scriptfiles")) do 
            os.cp(genfile , javapath)
        end
    end)
